Loop through opened modules

Ok, I have this code, and i wanna to make it fill the attributes of all opened modules, do any of you guys know how to do it?
I though of change the part:

-> m = current Module

more or less like trying to make a loop through the opened modules, the problem is how to do, I'm a little confused with the script...
 

void setStatus(){    
    /*
           Important: The following conditions shall be the same as used in dxl of 'Validation Status' column to show current status.
        */
        m = current Module
        Object o
        bool ValInd, NotEvalInd, NotValInd
        ValInd = false
        NotEvalInd = false
        NotValInd = false
        for o in m do {
        if (null o."Object Heading" "") {
        if (((o."Validation Q1SYS" ""=="YES" &&   o."Validation Q2SYS" ""=="YES" && o."Validation Q2HF" ""=="YES" && o."Validation Q1HF" ""=="YES")||(o."Validation Q1SYS" ""=="N/A" && o."Validation Q1HF" ""=="N/A" && o."Validation Q2SYS" ""=="YES" && o."Validation Q2HF" ""=="YES")||(o."Validation Q1SYS" ""=="YES" &&     o."Validation Q1HF" ""=="YES" && o."Validation Q2SYS" ""=="N/A" && o."Validation Q2HF" ""=="N/A")) && (m."Validation QCSYS" ""=="YES" && m."Validation QCHF" ""=="YES")) {
                          ValInd = true
                          }   
        else {        
        if ((o."Validation Q1SYS" ""=="Not Evaluated" && o."Validation Q1HF" ""=="Not Evaluated" && o."Validation Q2SYS" ""=="Not Evaluated" && o."Validation Q2HF" ""=="Not Evaluated") && ((m."Validation QCSYS" ""=="Not Evaluated" && m."Validation QCHF" ""=="Not Evaluated")||(m."Validation QCSYS" ""=="YES" && m."Validation QCHF" ""=="YES"))) {
                                          NotEvalInd = true
                                         }else NotValInd = true 
                                }
        }
        }
                if (NotValInd) {
                        m."Completeness Validation Status" = "Not Valid"
                        } else if (NotEvalInd){
                        m."Completeness Validation Status" =  "Not Validated"
                        } else m."Completeness Validation Status" = "Valid" ""
}


I will try some things here...if i get it done i tell you guys
Thanks


Bruwbruw - Wed Jul 25 12:44:09 EDT 2012

Re: Loop through opened modules
llandale - Wed Jul 25 13:36:42 EDT 2012

First off, you need to have the module open "Edit", and save it afterward.
Put "Module mod" as an input parameter and get rid of the "mod = current" statement.

[1] Generally, your wrapper script looks like this:

void  setStatus(Module mod)
{   your code here
}
 
 
for every FullModuleName in the Project
{  if (I don'tcare about this module) then continue
   mod = edit(FullModuleName, false, false, true)   // Invisibly, don't wait, standard view
   if (null mod) then complain; continue
   if (!isEdit(mod)) then complain, close(mod); continue  
   setStatus(mod)
   save(mod)
   close(mod)
}

[2] You said currently open modules:

for mod in (current Project) do
{  if (I don't care about this module) then continue
   if (!isEdit(mod)) then complain; continue
   setStatus(mod)
   save(mod)
}

[3] Perhaps you want just the "current" module?

Module mod = current
if (null mod) then complain "Run from open module"; halt
if (I don't care about this module) then complain "run from a certain type module"; halt
if (!isEdit(mod)) then complain "Run from Edited module"; halt
setStatus(mod)
save(mod)

"Don't care" may mean "Completeness Validation Status" attribute doesn't exist.

-Louie

 

Re: Loop through opened modules
Bruwbruw - Wed Jul 25 13:57:46 EDT 2012

llandale - Wed Jul 25 13:36:42 EDT 2012

First off, you need to have the module open "Edit", and save it afterward.
Put "Module mod" as an input parameter and get rid of the "mod = current" statement.

[1] Generally, your wrapper script looks like this:

void  setStatus(Module mod)
{   your code here
}
 
 
for every FullModuleName in the Project
{  if (I don'tcare about this module) then continue
   mod = edit(FullModuleName, false, false, true)   // Invisibly, don't wait, standard view
   if (null mod) then complain; continue
   if (!isEdit(mod)) then complain, close(mod); continue  
   setStatus(mod)
   save(mod)
   close(mod)
}

[2] You said currently open modules:

for mod in (current Project) do
{  if (I don't care about this module) then continue
   if (!isEdit(mod)) then complain; continue
   setStatus(mod)
   save(mod)
}

[3] Perhaps you want just the "current" module?

Module mod = current
if (null mod) then complain "Run from open module"; halt
if (I don't care about this module) then complain "run from a certain type module"; halt
if (!isEdit(mod)) then complain "Run from Edited module"; halt
setStatus(mod)
save(mod)

"Don't care" may mean "Completeness Validation Status" attribute doesn't exist.

-Louie

 

Thank you!
Now its working the way I wanted.